package cn.edu.bupt.mybatis.mapper;

import cn.edu.bupt.mybatis.entity.Comment;
import cn.edu.bupt.mybatis.entity.Product;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

public interface CommentMapper {
    @Select("select * from comment where product_id = #{prodId}")
    List<Comment> findByProdId(@Param(value = "prodId") int prodId);

    @Insert("insert into comment(text,product_id) values (#{text},#{productId})")
    @Options(useGeneratedKeys=true, keyProperty="id")
    int create(Comment comment);
}
